# -*- coding: utf-8 -*-
# standard
import os
import sys

# third
from fastapi import APIRouter, Request, Response, Depends
from fastapi import Query as QueryParam

# local
_P_PATH =  os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
if _P_PATH not in sys.path:
    sys.path.append(_P_PATH)
from functions import *
from toolbox.common_tools import INCLUDE_SCHEMA
from db import Resp
from toolbox.common_tools import logger, get_fastapi_real_ip


"""
@Title:  环境相关工具 
@File: env_view.py
@Author: walle 2025年05月23日 09时51分21秒
@Version: 1.0.0
@Desc: 
"""

router = APIRouter(prefix="/v1/env")
EXT = dict(tags=["环境"], response_model=Resp, include_in_schema=INCLUDE_SCHEMA)


@router.get("/current", summary="获取当前环境", **EXT)
async def get_current_view_by_request(
    request: Request,
):
    ip = get_fastapi_real_ip(request)
    return Resp(data={"ip": ip, "env": get_server_env_by_ip(ip)})





if __name__ == '__main__':
    pass